package crs.auxiliares.dao;
// Generated 02-ene-2015 19:41:22 by Hibernate Tools 4.3.1

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import crs.auxiliares.model.CrsIdiomas;

/**
 * Home object for domain model class CrsIdiomas.
 * @see .CrsIdiomas
 * @author Hibernate Tools
 */
@Repository
public class CrsIdiomasDaoImpl implements CrsIdiomasDao {

	private static final Log log = LogFactory.getLog(CrsIdiomasDaoImpl.class);

	@Autowired
	private SessionFactory sf;

	public void persist(CrsIdiomas transientInstance) {
		log.debug("persisting CrsIdiomas instance");
		try {
			sf.getCurrentSession().persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(CrsIdiomas persistentInstance) {
		log.debug("removing CrsIdiomas instance");
		try {
			sf.getCurrentSession().delete(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public CrsIdiomas merge(CrsIdiomas detachedInstance) {
		log.debug("merging CrsIdiomas instance");
		try {
			CrsIdiomas result = (CrsIdiomas) sf.getCurrentSession().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public CrsIdiomas findById(String id) {
		log.debug("getting CrsIdiomas instance with id: " + id);
		try {
			CrsIdiomas instance = (CrsIdiomas) sf.getCurrentSession().get(CrsIdiomas.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
